package com.d0330;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Properties;

class TestMethods {
    public static void main(String[] args) {
        File file = new File("src/com/d0330/config.properties");
        Class clazz = Account.class;
//        for (Method method:
//        clazz.getMethods()
// ) {
//            System.out.println(method.getName());
//        }
        FileReader fr= null;
        try {
            fr = new FileReader(file);
            Properties properties =new Properties();
            properties.load(fr);
            Method method = clazz.getMethod(properties.getProperty("todoMethod"),Double.class);
            Account account = (Account) clazz.newInstance();
            method.invoke(account,new Double(2000));
            System.out.println(account.getBalance());
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }

        //System.out.println();
    }
}